﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ContaSuite.Model;
using System.ComponentModel;

namespace ContaSuite.ViewModel
{
    class ClientViewModel: INotifyPropertyChanged
    {
        ClientModel clientModel;
        public List<x_client> ClientList { get; set; }

        private x_client _selectedClient;
        public x_client SelectedClient 
        {
            get
            {
                return _selectedClient;
            }
            set 
            {
                _selectedClient = value;
                OnPropertyChanged("SelectedClient");
            } 
        }

      
        public ClientViewModel()
        {
            clientModel = new ClientModel();

        }

        public void SetClientList(string matchString)
        {
            ClientList=clientModel.GetClients(matchString);
            
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void OnPropertyChanged(string PropertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(PropertyName));
            }
        }
    }
}
